Skip to content

Syntactically correct way of excluding Rust test code #1356

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arielb1 opened this issue May 22, 2025 · 1 comment
Open

Syntactically correct way of excluding Rust test code #1356

arielb1 opened this issue May 22, 2025 · 1 comment

Comments

@arielb1
Copy link

arielb1 commented May 22, 2025

As far as I can tell, there is no easy way in grcov to exclude all code that is included in #[cfg(test)] from test coverage. You can use ---excl-start, but there is no way to tell where the #[cfg(test)] block ends.

It would be good if there was some token-tree based mechanism for this.

I can try to implement a PR if this is desired.

@arielb1
Copy link
Author

arielb1 commented May 22, 2025

Another possibility would be to have an option that takes a list of lines to ignore per file, which can be computed in a smart way by an external process. Maybe it's smarter to filter the .gcno file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant